<?php
namespace app\user\validate\user;

use think\Validate;

/**
 * 提问验证
 */
class Question extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'    =>    ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'recive_user_id'    => 'require|integer',
        'content'           => 'require',
        'reply_user_id'     => 'require|integer',
        'question_id'       => 'require|integer'
    ];

    protected $field = [
        'recive_user_id'    => '被提问人',
        'content'           => '提问内容',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'    =>    '错误信息'
     *
     * @var array
     */
    protected $message = [
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'add'       => ['recive_user_id', 'content'],
        'addReply'  => ['reply_user_id', 'content', 'question_id'],
    ];

}
